class Chicken{
  constructor(ctx){
    this.ctx = ctx;
    this.img = new Image();
    this.img.src = 'images/chicken.jpg';
    //母鸡的不变的坐标位置
    this.init = {
      y: 38,
      w: 90,
      h: 100
    }
  }

  draw() {
    //绘制4只母鸡
    this.ctx.drawImage(this.img, this.ctx.canvas.width / 4 -95, this.init.y, this.init.w, this.init.h);
    this.ctx.drawImage(this.img, this.ctx.canvas.width / 4 , this.init.y, this.init.w, this.init.h);
    this.ctx.drawImage(this.img, this.ctx.canvas.width / 4 + 95, this.init.y, this.init.w, this.init.h);
    this.ctx.drawImage(this.img, this.ctx.canvas.width / 4 + 95*2, this.init.y, this.init.w, this.init.h);
  }
}
export default Chicken;